//
//  CollectionViewCell.m
//  网络图片浏览器
//
//  Created by 张钧 on 2017/5/4.
//  Copyright © 2017年 JinYun. All rights reserved.
//

#import "CollectionViewCell.h"
#import <UIImageView+WebCache.h>
@implementation CollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame
{
    if (self==[super initWithFrame:frame]) {
        [self.contentView addSubview:self.image];
    }
    return self;
}
-(void)setModel:(Model *)model
{
    _model=model;
   //图片位置
    _image.frame=CGRectMake(0, 0, self.contentView.frame.size.width, self.frame.size.height);
    //加载图片
 [_image sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@", _model.url]] placeholderImage:[UIImage imageNamed:@"IMG_0158.JPG"]];
}
-(UIImageView *)image
{
    if (!_image) {
        _image=[[UIImageView alloc]init];

    }
    return _image;
}
@end
